class Rectangulo {
  int x; // centro
  int y; // centro

  int rectWidth;
  int rectHeight;

  color rectColor;
  color origColor;

  Rectangulo (int x1, int y1, int width1, int height1, color color1 ) {

    x = x1;
    y = y1;
    rectWidth = width1;
    rectHeight = height1;

    rectColor = color1;

    origColor = color1;
  }

  void draw() {
    // Color y opacidad
    stroke(255, 0, 0);
    strokeWeight(5);

    fill(rectColor, 192);
    rect( (x-rectWidth/2), (y- rectHeight/2), rectWidth, rectHeight);
    fill (120);
    ellipse(x-25, y+rectHeight-5, 15, 15);
    ellipse(x+25, y+rectHeight-5, 15, 15);
}

  boolean revisarPosicion (int mX, int mY) {

    boolean resultado = false;

    if (mX > (x - rectWidth/2 )&&
      mX < (x+rectWidth/2) &&
      mY > (y - rectHeight/2) &&
      mY < (y + rectHeight/2) ) {
      resultado = true;
    }

    return resultado;
  }

  void cambiarBrillo() {
    rectColor = color ( hue(rectColor), saturation(rectColor), brightness(rectColor) + 200);
  }

  void reiniciarColor() {
    rectColor = origColor;
  }
}

